package cn.yuanqiao.web.controller.archive.wenjianzhengli;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.yuanqiao.common.annotation.Log;
import cn.yuanqiao.common.enums.BusinessType;

import cn.yuanqiao.archive.wenjianzhengli.domain.ConveryFormat;
import cn.yuanqiao.archive.wenjianzhengli.service.IConveryFormatService;
import cn.yuanqiao.common.web.controller.BaseController;
import cn.yuanqiao.common.core.domain.AjaxResult;
import cn.yuanqiao.common.utils.poi.ExcelUtil;
import cn.yuanqiao.common.web.page.TableDataInfo;

/**
 * 转换格式Controller
 * 
 * @author xy
 * @date 2024-01-17
 */
@RestController
@RequestMapping("/archive/converyFormat")
public class ConveryFormatController extends BaseController
{
    @Autowired
    private IConveryFormatService converyFormatService;

    /**
     * 查询转换格式列表
     */
/*
    @PreAuthorize("@ss.hasPermi('archive:gszh:list')")
*/
    @GetMapping("/list")
    public TableDataInfo list(ConveryFormat converyFormat)
    {
       // startPage();
        List<ConveryFormat> list = converyFormatService.selectConveryFormatList(converyFormat);
        return getDataTable(list);
    }

    /**
     * 导出转换格式列表
     */
/*
    @PreAuthorize("@ss.hasPermi('archive:ConveryFormat:export')")
*/
    @Log(title = "转换格式", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ConveryFormat converyFormat)
    {
        List<ConveryFormat> list = converyFormatService.selectConveryFormatList(converyFormat);
        ExcelUtil<ConveryFormat> util = new ExcelUtil<ConveryFormat>(ConveryFormat.class);
        util.exportExcel(response, list, "转换格式数据");
    }

    /**
     * 获取转换格式详细信息
     */
/*
    @PreAuthorize("@ss.hasPermi('archive:ConveryFormat:query')")
*/
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(converyFormatService.selectConveryFormatById(id));
    }

    /**
     * 新增转换格式
     */


    @Log(title = "转换格式", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ConveryFormat converyFormat)
    {
        return toAjax(converyFormatService.insertConveryFormat(converyFormat));
    }

    /**
     * 修改转换格式
     */
/*
    @PreAuthorize("@ss.hasPermi('archive:ConveryFormat:edit')")
*/
    @Log(title = "转换格式", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ConveryFormat converyFormat)
    {
        return toAjax(converyFormatService.updateConveryFormat(converyFormat));
    }

    /**
     * 删除转换格式
     */
/*
    @PreAuthorize("@ss.hasPermi('archive:ConveryFormat:remove')")
*/
    @Log(title = "转换格式", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(converyFormatService.deleteConveryFormatByIds(ids));
    }
}
